﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Carbon.Web.Forms.Extensions;
using Demo.Extensions;

namespace Demo.Demos
{
    public partial class EntityFramework : DemoPage
    {
        public String GetImageUrl(Control context)
        {
            ViewModelEntityFramework model = (ViewModelEntityFramework)context.GetViewModelContext();
            return ImageHandler.GetFileReferenceImageUrl(model.Avatar);
        }

        
        protected void Click_Save(object sender, EventArgs args)
        {
            this.SafeExecute(() =>
            {
                if (!this.ValidateRecursively())
                {
                    throw new ApplicationException("Data not valid");
                }

                throw new ApplicationException("Success");
            });
        }
    }
}